<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
      <#include "/common/elibs.html">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  </head>
  <script>var index;
  </script><body>
    <div class="x-body">
        <form class="layui-form">
            <input type="hidden" name="idxProAdmin" id="idxProAdmin" value="${id}"/>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    开始时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="beginTime" name="beginTime"
                           autocomplete="off" class="layui-input" disabled style="background-color: #b7b1b1;">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    结束时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="endTime" name="endTime"
                           autocomplete="off" class="layui-input" disabled style="background-color: #b7b1b1;">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    距离结束时间天数
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="differenceTime" name="differenceTime"
                           autocomplete="off" class="layui-input" disabled style="background-color: #b7b1b1;">
                </div>
            </div>

            <!--<div class="layui-form-item">
                <label for="customerName" class="layui-form-label">
                    <span class="x-red">*</span>填报单位签章
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="customerName" name="customerName" lay-verify="" placeholder="请输入"
                           autocomplete="off" class="layui-input" disabled >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="customerName" class="layui-form-label">
                    <span class="x-red">*</span>填报人
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="idxTwoOperstor" name="idxTwoOperstor" lay-verify="" placeholder="请输入"
                           autocomplete="off" class="layui-input" disabled >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="customerName" class="layui-form-label">
                    <span class="x-red">*</span>填报时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="reportingDate" name="reportingDate" lay-verify="" placeholder="请输入"
                           autocomplete="off" class="layui-input" disabled >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>-->
            <div class="layui-form-item">
                <label for="nameOfSubstation" class="layui-form-label">
                    <span class="x-red">*</span>变电站名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="nameOfSubstation" name="nameOfSubstation" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="equipmentChangeNature" class="layui-form-label">
                    <span class="x-red">*</span>设备变更性质
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="equipmentChangeNature" name="equipmentChangeNature" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="deviceName" class="layui-form-label">
                    <span class="x-red">*</span>设备名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="deviceName" name="deviceName" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="regularImpedancePositiveSequence" class="layui-form-label">
                    <span class="x-red">*</span>110KV实则阻抗正序
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="regularImpedancePositiveSequence" name="regularImpedancePositiveSequence" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="zeroSequence" class="layui-form-label">
                    <span class="x-red">*</span>零序
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="zeroSequence" name="zeroSequence" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>

            <div class='layui-col-md6 powerSupply' style='width: 100%;'>
                <div class='layui-card'>
                    <div class="layui-card-header">各测容量</div>
                    <div class="layui-form-item">
                        <label for="highPressureSide" class="layui-form-label">
                            <span class="x-red">*</span>高压侧
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="highPressureSide" name="highPressureSide" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="mediumPressureSide" class="layui-form-label">
                            <span class="x-red">*</span>中压侧
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="mediumPressureSide" name="mediumPressureSide" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="lowPressureSide" class="layui-form-label">
                            <span class="x-red">*</span>低压侧
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="lowPressureSide" name="lowPressureSide" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class='layui-col-md6 powerSupply' style='width: 100%;'>
                <div class='layui-card'>
                    <div class="layui-card-header">短路电压</div>
                    <div class="layui-form-item">
                        <label for="gaoYiZhong" class="layui-form-label">
                            <span class="x-red">*</span>高一中
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="gaoYiZhong" name="gaoYiZhong" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="gaoYiDi" class="layui-form-label">
                            <span class="x-red">*</span>高一低
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="gaoYiDi" name="gaoYiDi" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="zhongYiDi" class="layui-form-label">
                            <span class="x-red">*</span>中一低
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="zhongYiDi" name="zhongYiDi" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="connectionGroup" class="layui-form-label">
                    <span class="x-red">*</span>接线组别
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="connectionGroup" name="connectionGroup" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="loadingAndPressingForm" class="layui-form-label">
                    <span class="x-red">*</span>装压形式
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="loadingAndPressingForm" name="loadingAndPressingForm" lay-verify="required" placeholder="请输入"
                           autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>

            <div class='layui-col-md6 powerSupply' style='width: 100%;'>
                <div class='layui-card'>
                    <div class="layui-card-header">高压侧</div>
                    <div class="layui-form-item">
                        <label for="onSiteVariationOfHighPressureSide" class="layui-form-label">
                            <span class="x-red">*</span>现场变化
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="onSiteVariationOfHighPressureSide" name="onSiteVariationOfHighPressureSide" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="onSiteVariationOfHighPressureSideInstallationLocation" class="layui-form-label">
                            <span class="x-red">*</span>安装部位
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="onSiteVariationOfHighPressureSideInstallationLocation" name="onSiteVariationOfHighPressureSideInstallationLocation" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                </div>
            </div>

            <div class='layui-col-md6 powerSupply' style='width: 100%;'>
                <div class='layui-card'>
                    <div class="layui-card-header">中压侧</div>
                    <div class="layui-form-item">
                        <label for="fieldVariationOfMediumPressureSide" class="layui-form-label">
                            <span class="x-red">*</span>现场变化
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="fieldVariationOfMediumPressureSide" name="fieldVariationOfMediumPressureSide" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="fieldVariationOfMediumPressureSideInstallationLocation" class="layui-form-label">
                            <span class="x-red">*</span>安装部位
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="fieldVariationOfMediumPressureSideInstallationLocation" name="fieldVariationOfMediumPressureSideInstallationLocation" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                </div>
            </div>
            <div class='layui-col-md6 powerSupply' style='width: 100%;'>
                <div class='layui-card'>
                    <div class="layui-card-header">低压侧</div>
                    <div class="layui-form-item">
                        <label for="fieldVariationOfLowPressureSide" class="layui-form-label">
                            <span class="x-red">*</span>现场变化
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="fieldVariationOfLowPressureSide" name="fieldVariationOfLowPressureSide" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="fieldVariationOfLowPressureSideInstallationLocation" class="layui-form-label">
                            <span class="x-red">*</span>安装部位
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="fieldVariationOfLowPressureSideInstallationLocation" name="fieldVariationOfLowPressureSideInstallationLocation" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                </div>
            </div>

            <div class='layui-col-md6 powerSupply' style='width: 100%;'>
                <div class='layui-card'>
                    <div class="layui-card-header">负荷</div>
                    <div class="layui-form-item">
                        <label for="lineAndBranchNameOfPlatformChange" class="layui-form-label">
                            <span class="x-red">*</span>线路及支线，变台名称
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="lineAndBranchNameOfPlatformChange" name="lineAndBranchNameOfPlatformChange" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="loadProperty" class="layui-form-label">
                            <span class="x-red">*</span>负荷性质（公用，专用，照明，动力或冶炼）
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="loadProperty" name="loadProperty" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="maximumLoadCurrent" class="layui-form-label">
                            <span class="x-red">*</span>最大负荷电流(A)
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="maximumLoadCurrent" name="maximumLoadCurrent" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="maximumLoadVoltage" class="layui-form-label">
                            <span class="x-red">*</span>最大负荷电压等级(KV)
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="maximumLoadVoltage" name="maximumLoadVoltage" lay-verify="required" placeholder="请输入"
                                   autocomplete="off" class="layui-input" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="" class="layui-form-label">
                    <span class="x-red">*</span>运行方式要求
                </label>
                <div class="layui-input-inline">
                    <textarea id="content"  name="operatingModeRequirements" style="display: none;"
                              class="layui-hide"></textarea>
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="maximumLoadVoltage" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="preservation" type=button codeTyle="1" lay-submit="">
                    保存
                </button>
                <button  class="layui-btn" lay-filter="preAdd" type=button type=button codeTyle="2" lay-submit="">
                    预提交
                </button>
                <button  class="layui-btn" lay-filter="add" type=button codeTyle="3" lay-submit="">
                    提交
                </button>
            </div>
      </form>
    </div>
    <script>

        getProTime($("#idxProAdmin").val(),30);
        var layedit = '',contentIndex;
        layui.use('layedit', function(){
            layedit = layui.layedit;
            layedit.set({
                uploadImage: {
                    url: path + '/pc/upload/uploadFile' //接口url
                    ,type: 'post' //默认post
                }
            });
            contentIndex = layedit.build("content"); //建立编辑器
        });

        layui.use(['form','layer'], function() {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer, layedit = layui.layedit;
            //自定义验证规则
            form.verify({
                otherReq: function(value,item){
                    var $ = layui.$;
                    var verifyName=$(item).attr('name')
                        , verifyType=$(item).attr('type')
                        ,formElem=$(item).parents('.layui-form')//获取当前所在的form元素，如果存在的话
                        ,verifyElem=formElem.find('input[name='+verifyName+']')//获取需要校验的元素
                        ,isTrue= verifyElem.is(':checked')//是否命中校验
                        ,focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
                    if(!isTrue || !value) {
                        //定位焦点
                        focusElem.css(verifyType == 'radio' ? {"color": "#FF5722"} : {"border-color": "#FF5722"});
                        //对非输入框设置焦点
                        focusElem.first().attr("tabIndex", "1").css("outline", "0").blur(function () {
                            focusElem.css(verifyType == 'radio' ? {"color": ""} : {"border-color": ""});
                        }).focus();
                        return '必填项不能为空';
                    }
                }
            });


            //监听提交
            form.on('submit(add)', function (t) {
                addSubmit(3);
            });

            //监听保存
            form.on('submit(preservation)', function (t) {
                addSubmit(1);
            });

            //监听预提交
            form.on('submit(preAdd)', function (t) {
                addSubmit(2);
            });
        });

        function addSubmit(submitState){
            var params = {
                //tcaDescribe : layui.layedit.getContent(index),
                "idProAdmin": $("#idxProAdmin").val(),
                "nameOfSubstation": $("#nameOfSubstation").val(),
                "equipmentChangeNature": $("#equipmentChangeNature").val(),
                "deviceName": $("#deviceName").val(),
                "regularImpedancePositiveSequence": $("#regularImpedancePositiveSequence").val(),
                "zeroSequence": $("#zeroSequence").val(),
                "highPressureSide": $("#highPressureSide").val(),
                "mediumPressureSide": $("#mediumPressureSide").val(),
                "lowPressureSide": $("#lowPressureSide").val(),
                "gaoYiZhong": $("#gaoYiZhong").val(),
                "zhongYiDi": $("#zhongYiDi").val(),
                "gaoYiDi": $("#gaoYiDi").val(),
                "connectionGroup": $("#connectionGroup").val(),
                "loadingAndPressingForm": $("#loadingAndPressingForm").val(),
                "onSiteVariationOfHighPressureSide": $("#onSiteVariationOfHighPressureSide").val(),
                "onSiteVariationOfHighPressureSideInstallationLocation":
                    $("#onSiteVariationOfHighPressureSideInstallationLocation").val(),

                "fieldVariationOfMediumPressureSide": $("#fieldVariationOfMediumPressureSide").val(),
                "fieldVariationOfMediumPressureSideInstallationLocation": $("#fieldVariationOfMediumPressureSideInstallationLocation").val(),
                "lineAndBranchNameOfPlatformChange": $("#lineAndBranchNameOfPlatformChange").val(),
                "loadProperty": $("#loadProperty").val(),
                "fieldVariationOfLowPressureSide": $("#fieldVariationOfLowPressureSide").val(),
                "fieldVariationOfLowPressureSideInstallationLocation": $("#fieldVariationOfLowPressureSideInstallationLocation").val(),

                "maximumLoadCurrent": $("#maximumLoadCurrent").val(),
                "maximumLoadVoltage": $("#maximumLoadVoltage").val(),
                "operatingModeRequirements":layedit.getContent(contentIndex),
                "submitState":submitState
            }
            if (true) {
                ajaxFunJson('post','/pc/project/addProtectionFixedValueReporting',JSON.stringify(params),function(data){
                    if (data.code != 0) {
                        alertFun(data);
                    } else {
                        window.location.href = path + "/modules/project/towPro/bhdzbs/list.html";
                        console.log("success !");
                    }
                })
                return false;
            }
        }
    </script></body></html>